Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

COBOL Online Compiler and Runner


COBOL Online Compiler and Runner

Type COBOL on the left, press Run, see output on the right  •  100% in your browser

Try the COBOL exams: Basic | Intermediate | Expert
Teaching interpreter: this page runs a beginner subset of COBOL entirely in your browser — it is not a full COBOL compiler and does not connect to a mainframe. Type a program on the left, press Run, and see the output on the right.
COBOL source
Console output

Most Common COBOL Programs

Click Load & Run on any card to load the program into the editor above and run it instantly.

Supported statements (beginner subset)

  • WORKING-STORAGE: 01/77 levels with PIC X(n), PIC 9(n), PIC 9(n)V9(m)
  • DISPLAY 'text' var1 var2 — string literals in quotes plus variables
  • MOVE a TO b — literal or variable to variable
  • COMPUTE x = expression — with + - * / and parentheses
  • ADD a TO b — SUBTRACT a FROM b — MULTIPLY a BY b — DIVIDE a INTO b
  • IF condition ... ELSE ... END-IF — conditions: = <> > < >= <=, AND / OR
  • PERFORM n TIMES ... END-PERFORM — PERFORM UNTIL condition ... END-PERFORM
  • Paragraphs (PARA-NAME.) called with PERFORM PARA-NAME
  • ACCEPT var (uses a browser prompt) — STOP RUN

Errors are reported with line numbers, e.g. Line 7: unknown variable WS-FOO. Not supported: files (FD/SELECT), CALL, COPY, OCCURS tables, EVALUATE — the interpreter will tell you when it meets something it cannot run.






© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant